<template>
	<view>
		<cu-custom bgColor="bg-white" :isBack="true">
			<block slot="content">调薪申请</block>
			<block slot="right">
				<image @click="showFun" class="nav-right-image" src="@/static/images/nav_opt.png"></image>
			</block>
		</cu-custom>

		<view class="page-content" :style="{height:this.ContentArea+'px',paddingTop:'30rpx'}">
			<view class="page-search">
				<view class="search">
					<view class="search-left" @click="searchBtn">
						<image src="@/static/images/search.png" mode="aspectFit" />
					</view>
					<input class="search-center" type="text" placeholder="搜索名字/工号"
						placeholder-class="search-placeholder" v-model="searchValue">
				</view>
			</view>

			<view class="page-content-main">
				<view class="select-box">

          <view style="position: relative;">
            <uni-datetime-picker v-model="createTime" type="line">
              <view class="select">
                <view class="select-value">{{ createTimeShow }}</view>
                <view class="select-icon" v-if="createTime ==''">
                  <image src="@/static/images/downArrow.png" mode="aspectFit" />
                </view>
              </view>
            </uni-datetime-picker>
            <view class="cuIcon-roundclose" v-if="createTime !=''"
                  style="z-index: 9;width: 20px;height: 20px;position: absolute;right: 55rpx;top: 25rpx;color: #FFFFFF;"
                  @click="clearDatetimePicker">
            </view>
          </view>

					<view class="select">
						<view class="cu-form-group">
							<view class="title"></view>
							<picker @change="bindPickerChange" :value="index" :range="array">
								<view class="picker">
									{{index>-1?array[index]:'请选择'}}
								</view>
							</picker>
						</view>
						<view class="select-icon">
							<image src="@/static/images/downArrow.png" mode="aspectFit" />
						</view>
					</view>
				</view>

				<view>
					<view class="grid margin-bottom text-center col-2">
					    <view class="bg-white" v-for="(item,indexs) in dataList" :key="indexs" style="border-radius: 20px;margin-top: 25px;padding:5px;" :style="indexs%2==0?'margin-right: 13px;': ''">
							<image style="width: 40px; height: 40px;margin-top: -15px;overflow: visible;" src="@/static/images/avatar.png"></image>
							<view style="font-size: 18px;font-weight: 500;color: #000000;">
								{{item.name}}
							</view>
							<view style="font-size: 10px;font-weight: 400;color: #7B7B7B;margin-top: 12px;">
								职位等级
							</view>
							<view style="font-size: 10px;font-weight: 400;color: #000000;margin-top: 5px;">
								{{item.jobLevel}}
							</view>
							<view style="margin-top: 10px;">
								<view class="flex">
								    <view class="flex-sub margin-xs" style="border-radius: 11px;background-color: rgba(135, 98, 255, 0.04);padding: 8px;">
										<view style="display: flex;align-items: center;">
											<image style="width: 15px; height: 15px;" src="@/static/images/Group3.png"></image>
											<text style="color: #5B5B5B;font-size: 10px;margin-left: 5px;">
												调薪前
											</text>
										</view>
										<view style="font-size: 16px;font-weight: 600;color: #101317;margin-top: 5px;">
											{{item.beforeSalary}}
										</view>
									</view>
									<view class="flex-sub margin-xs" style="border-radius: 11px;background-color: rgba(52, 166, 89, 0.05);padding: 8px;">
										<view style="display: flex;align-items: center;">
											<image style="width: 15px; height: 15px;" src="@/static/images/Group3.png"></image>
											<text style="color: #5B5B5B;font-size: 10px;margin-left: 5px;">
												调薪后
											</text>
										</view>
										<view style="font-size: 16px;font-weight: 600;color: #101317;margin-top: 5px;">
											{{item.afterSalary}}
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>

			</view>

		</view>

		<view class="fun-wrap" v-show="isShowFun" @click="hideFun">
			<view class="fun-box" :style="{top:this.CustomBar+'px'}">
				<view class="fun-item" @click.stop="gotoAdd">
					<image class="fun-icon" src="@/static/images/addIcon.png" />
					<text class="fun-text">新增</text>
				</view>
				<view class="fun-item" @click="importBtn">
					<image class="fun-icon" src="@/static/images/importIcon.png" />
					<text class="fun-text">导入</text>
				</view>
				<view class="fun-item" @click="exportBtn">
					<image class="fun-icon" src="@/static/images/exportIcon.png" />
					<text class="fun-text">导出</text>
				</view>
				<view class="fun-item" @click="draftBatchBtn">
					<image class="fun-icon" src="@/static/images/draftIcon.png" />
					<text class="fun-text">草稿箱</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import moment from 'moment';
	export default {
		data() {
			return {
				index: 0,
				array: ['全部','进行中'],
        createTime: moment().format('YYYY-MM-DD'),
				searchValue: '',
				dataList: [{
					img: '',
					name: '孙泽香',
					jobLevel:'副主管及以上管理人员',
					beforeSalary:'6K',
					afterSalary:'8K'
				},{
					img: '',
					name: '孙泽香',
					jobLevel:'副主管及以上管理人员',
					beforeSalary:'6K',
					afterSalary:'8K'
				},{
					img: '',
					name: '孙泽香',
					jobLevel:'副主管及以上管理人员',
					beforeSalary:'6K',
					afterSalary:'8K'
				},{
					img: '',
					name: '孙泽香',
					jobLevel:'副主管及以上管理人员',
					beforeSalary:'6K',
					afterSalary:'8K'
				}],
				isShowFun: false,
				isShowDetails: false,
				detailsBar: 0, // 初始位置
				refreshing: true,
				pageSize: 10,
				pageNo: 1,
				total: 0,
				listUrl: ''
			}
		},
		mounted() {

		},
		computed: {
			createTimeShow: function() {
				return moment(this.createTime).isValid() ? moment(this.createTime).format('MM-DD') : '请选择'
			}
		},
		methods: {
			searchBtn() {
				console.log(this.searchValue)
			},
			clearSearch() {
				this.searchValue = ''
			},
			bindPickerChange(e) {
				this.index = e.detail.value
			},
			showFun() {
				this.isShowFun = true
			},
			hideFun() {
				this.isShowFun = false
			},
			showDetails(event) {
				var targetElement = document.getElementById(event);
				var elementY = this.getElementY(targetElement);
				this.detailsBar = elementY + 20;
				this.isShowDetails = true
			},
			getElementY(element) {
				var rect = element.getBoundingClientRect();
				return rect.top + window.scrollY;
			},
			hideDetails() {
				this.isShowDetails = false
			},
			gotoAdd() {
				console.log('新增')
				// uni.navigateTo({
				// 	url: '/pages/contractList/contractListAdd/index'
				// })
			},
			deleteBtn() {
				console.log('删除')
			},
			importBtn() {
				console.log('导入')
			},
			exportBtn() {
				console.log('导出')
			},
			printBrandBtn() {
				console.log('打印产牌')
			},
			editPeoBtn() {
				console.log('修改拥有者')
			},
			printBatchBtn() {
				console.log('批量打印')
			},
			draftBatchBtn(){
				console.log('草稿箱')
			},
			toDetails() {
				console.log('详情')
				uni.navigateTo({
					url: '/pages/contractList/contractListDetails/index'
				})
			},
      clearDatetimePicker() {
        this.createTime = ''
      }
		}
	}
</script>

<style lang="scss" scoped>
	image {
		width: 100%;
		height: 100%;
	}

	.blackList {
		height: 100%;
		overflow: hidden;
	}

	.page-search {
		padding-left: 34rpx;
		margin-bottom: 12rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.search {
		width: 680rpx;
		height: 86rpx;
		background-color: rgba(249, 249, 249, 1);
		border-radius: 60rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		padding-left: 24rpx;
		padding-right: 24rpx;

		.search-left {
			width: 28rpx;
			height: 28rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.search-center {
			margin-left: 22rpx;
		}

		.search-placeholder {
			font-size: 28rpx;
			font-weight: 400;
			color: #7C7C7C;
		}


	}

	.filter-btn {
		width: 40rpx;
		height: 40rpx;
		margin-right: 42rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.page-content-main {
		height: calc(100% - 12rpx - 86rpx);
		border-top-left-radius: 64rpx;
		border-top-right-radius: 64rpx;
		padding: 26rpx 34rpx 0 34rpx
	}

	.select-box {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;

	}

	.select {
		width: 160rpx;
		height: 74rpx;
		border-radius: 60rpx;
		background-color: #4591FE;
		margin-bottom: 20rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		margin-right: 48rpx;
		position: relative;

    .select-value {
      font-size: 28rpx;
      font-weight: 400;
      color: #FFFFFF;
      margin-right: 18rpx;
    }

    .select-icon {
      width: 22rpx;
      height: 22rpx;
      display: flex;
      justify-content: center;
      align-items: center;
      position: absolute;
      right: 20rpx;
      top:25rpx;
    }
	}

	.list {
		height: calc(100% - 74rpx - 20rpx);
	}

	.list-item {
		border-radius: 28rpx;
		background-color: #FFFFFF;
		padding: 26rpx 24rpx 28rpx 20rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		margin-bottom: 26rpx;
		position: relative;

		.list-item-leftCenter {
			display: flex;
			flex-direction: row;
		}

		.list-item-left {
			width: 86rpx;
			height: 86rpx;
			margin-right: 26rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.list-item-center {
			.list-item-row {
				display: flex;
				flex-direction: row;
				margin-bottom: 20rpx;

				.list-item-name {
					color: #101317;
					font-size: 32rpx;
					margin-right: 16rpx;
				}

				.list-item-sex {
					width: 106rpx;
					height: 42rpx;
					border-top-right-radius: 40rpx;
					border-bottom-right-radius: 40rpx;
					border-bottom-left-radius: 20rpx;
					background-color: rgba(234, 171, 78, 0.35);
					line-height: 42rpx;
					text-align: center;
					color: rgba(255, 173, 4, 1);
					font-size: 24rpx;
				}

				.list-item-row-icon {
					width: 38rpx;
					height: 38rpx;
					margin-right: 10rpx;
					display: flex;
					justify-content: center;
					align-items: center;
				}

				.list-item-row-title,
				.list-item-row-value {
					font-size: 24rpx;
					font-weight: 400;
					color: #101317;
					line-height: 38rpx;
				}

			}
		}

		.list-item-btn {
			width: 36rpx;
			height: 36rpx;
			margin-top: 56rpx;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.list-item-tab {
			width: 132rpx;
			height: 56rpx;
			text-align: center;
			line-height: 56rpx;
			background-color: rgba(69, 145, 254, 0.4);
			position: absolute;
			top: 0;
			right: 0;
			border-top-right-radius: 26rpx;
			border-bottom-left-radius: 20rpx;
		}

		.list-item-tab-text {
			font-size: 26rpx;
			color: rgba(69, 145, 254, 1)
		}
	}

	.nav-right-image {
		width: 80rpx;
		height: 80rpx;
		margin-left: 15px;
	}

	.fun-wrap {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-color: rgba(3, 3, 3, 0.28);
		z-index: 10000;
	}

	.fun-box {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
		flex-wrap: wrap;
		width: 556rpx;
		height: 444rpx;
		border-top-left-radius: 42rpx;
		border-bottom-left-radius: 42rpx;
		border-bottom-right-radius: 42rpx;
		position: absolute;
		right: 74rpx;
		background-color: #FFFFFF;
		padding-top: 35rpx;
	}

	.fun-item {
		width: 185rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin-bottom: 44rpx;
	}

	.fun-icon {
		width: 92rpx;
		height: 92rpx;
		margin-bottom: 22rpx;
	}

	.cu-form-group {
		background-color: transparent;
	}

	::v-deep {
		.cu-form-group uni-picker .picker {
			color: #FFFFFF;
		}

		.cu-form-group uni-picker::after {
			opacity: 0;
		}
	}

	.textView {
		margin-left: 15px;
		font-size: 10px;
		margin-top: 5px;
	}

	.listText {
		font-size: 16px;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		color: #101317;
	}

	.details-box {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
		flex-wrap: wrap;
		border-top-left-radius: 42rpx;
		border-bottom-left-radius: 42rpx;
		border-bottom-right-radius: 42rpx;
		position: absolute;
		right: 65px;
		background-color: #FFFFFF;
		padding: 5px 15px;
	}

	.listTextTwo {
		font-size: 10px;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		color: #101317;
		margin-left: 5px;
	}
	.grid.col-2>uni-view {
	    width: 48%;
	}
</style>
